#!/bin/bash
reset
gcc -o gauss-legndre-multi gauss-legndreMultThread.c  -lm -lgmp -lpthread -O3
gcc -o gauss-legndre-mono gauss-legndreMonoThread.c  -lm -lgmp -lpthread -O3
gcc -o borwein borwein.c -lgmp  -lm -O3
gcc -o borwein_par borwein_par.c -lgmp  -lm -lpthread -O3
g++ -o mc_t mc_t.cpp -lpthread -lgmp -lgmpxx -lm -O3
g++ -o mc_threads mc_threads.cpp -lpthread -lgmp -lgmpxx -lm -O3
menu()
{
echo "######################################################"
echo "Concorrentes Turma A"
echo ""
echo "Alfredo Lima"
echo "Diego Gomes"
echo "Marcos Vinicius"
echo ""
echo "######################################################"
echo ""
echo "Métodos de calculo disponiveis:"
echo ""
echo " 1 - Gauss-Legendre "
echo " 2 - Gauss-Legendre (multi-thread) "
echo " 3 - borwein "
echo " 4 - borwein (multi-thread)"
echo " 5 - monte carlo "
echo " 6 - monte carlo (multi-thread)"
echo ""
echo  -n "Escolha um método para o calculo do nº pi. Ex.: 1: "
read Metodo
if [ $Metodo = "2" ]
then


time ./gauss-legndre-multi  > gauss-legndre-multi_npi

echo ""
echo ""
exit 0
elif [ $Metodo = "1" ]
then



time ./gauss-legndre-mono  > gauss-legndre-mono_npi 

echo ""
echo ""
exit 0
elif [ $Metodo = "3" ]
then



time ./borwein  > borwein_npi 

echo ""
echo ""
exit 0
elif [ $Metodo = "4" ]
then



time ./borwein_par  > borwein_par_npi 

echo ""
echo ""
exit 0
elif [ $Metodo = "5" ]
then



time ./mc_t  > mc_t_npi 

echo ""
echo ""
exit 0
elif [ $Metodo = "6" ]
then



time ./mc_threads  > mc_threads_npi 

echo ""
echo ""
exit 0
elif [ -z $Metodo ]
then
clear
echo "Escolha um dos métodos disponiveis..."
sleep 2
menu
fi
}

menu;